'use strict';

module.exports = app => {
  const { CHAR, STRING } = app.Sequelize;

  // 微信账户
  const WechatAccount = app.model.define('wechatAccount', {
    // 开放ID
    openId: { type: CHAR(28), primaryKey: true },
    // 用户头像
    avatarUrl: STRING,
  });

  WechatAccount.associate = function() {
    // 用户
    WechatAccount.belongsTo(app.model.User);
    // 提现用户
    WechatAccount.hasMany(app.model.Withdrawal);
  };

  return WechatAccount;
};
